<template>
	<view>
		<view class="m-2 pl-3 py-1 bg-white rounded-20 recom">
			<view class="recom_content" v-for="(item, index) in recomList" :key="index" @click="tab_recom(item,index)">
				<view class="d-flex border-bottom j-sb py-3 ">
					<view class="">{{item.title}}</view>
					<view class="d-flex mr-3" v-show="index==recomIndex" >
						<image class="icon_selected" :src="item.src" mode=""></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				recomList:[
					{title:"全部",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"平台推荐新品",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"平台推荐精品",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"平台推荐热销",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"商家推荐新品",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"商家推荐精品",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"商家推荐热销",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"平台全部推荐",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"商家全部推荐",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
					{title:"特价",recomShow:false,src:"../../static/images/goods/icon_selected.png"},
				],
				recomIndex:0
			}
		},
		methods: {
			tab_recom(item,index){
				this.recomIndex=index
				var globalData = getApp().globalData.closeLists; //获取全局变量
				getApp().globalData.closeLists= item.title; //修改全局变量
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style>
	.icon_selected{
		width: 35upx;
		height: 35upx;
	}
	.recom_content:last-child ::after{
		border: none;
	}
</style>
